package com.dmgis.hndz.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dmgis.hndz.pojo.Ggsy01a;
import com.dmgis.hndz.pojo.Ggsy02a;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface Ggsy01aMapper extends BaseMapper<Ggsy01a> {

    @Select("select * from ggsy01a where length(ggsy01a020) < 7 order by ggsy01a020")
    List<Ggsy01a> getProXzdy();

    @Select("select * from ggsy01a where length(ggsy01a020) > 2 and length(ggsy01a020) < 10 order by ggsy01a020")
    List<Ggsy01a> getCityXzdy();

    @Select("select * from ggsy01a where length(ggsy01a020) > 4 and length(ggsy01a020) < 13 order by ggsy01a020")
    List<Ggsy01a> getCountyXzdy();

    @Select("select * from ggsy01a where ggsy01a040 = #{parentId} and ggsy01a050 = #{type}")
    List<Ggsy01a> getRegion(@Param("type") String type, @Param("parentId") Long parentId);

    /**
     * 查询市级行政区域或县级行政区域
     *
     * @param advcode 行政编码
     * @return
     */
    List<Ggsy01a> getCityOrCountyXzdy(String advcode);
}
